package com.zw.cloud.mybatis.plus.mapper.stenter;

import com.zw.cloud.mybatis.plus.entity.stenter.OptimizeCraftPageDTO;
import com.zw.cloud.mybatis.plus.entity.stenter.ProductRecordDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 生产记录关联表 Mapper 接口
 * </p>
 *
 * @author zw
 * @since 2023-10-31
 */
public interface ProductRecordDetailMapper extends BaseMapper<ProductRecordDetail> {

    int onDuplicateKeyUpdate(List<ProductRecordDetail> list);

    int onDuplicateKeyUpdateForFillNull(List<ProductRecordDetail> list);

    List<Long> queryBaseTenterCraftId(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

    List<Long> queryProductInfoIdByBaseTenterCraftId(@Param("baseTenterCraftId") Long baseTenterCraftId,@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

    @Select({"${sql}"})
    @ResultType(OptimizeCraftPageDTO.class)
    List<OptimizeCraftPageDTO> queryOptimizeCraftData(@Param("sql") String sql);
}
